package o;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.appgallery.serverreqkit.api.bean.startup.StartupResponse$OOBEAppInfo;
import com.huawei.appmarket.R;

public class dlk {
    private CheckBox ˊ = null;
    private OnCheckedChangeListener ˋ;
    private boolean ॱ = false;

    public View ˎ(Context context, int i, int i2, int i3, StartupResponse$OOBEAppInfo startupResponse$OOBEAppInfo) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.oobe_view_selectable_item, null);
        LinearLayout linearLayout = (LinearLayout) inflate.findViewById(R.id.selectableApp_rootView);
        LayoutParams layoutParams = (LayoutParams) ((FrameLayout) inflate.findViewById(R.id.selectableApp_icon_layout)).getLayoutParams();
        int ˊ = epv.ˊ() + ContentManager.getInstant().getContext().getResources().getDimensionPixelSize(R.dimen.margin_m);
        layoutParams.width = ˊ;
        layoutParams.height = ˊ;
        eqx.ˎ((ImageView) inflate.findViewById(R.id.selectableApp_iconIV), startupResponse$OOBEAppInfo.ʼ());
        final CheckBox checkBox = (CheckBox) inflate.findViewById(R.id.selectableApp_selectedCB);
        this.ˊ = checkBox;
        ˋ(checkBox, startupResponse$OOBEAppInfo);
        checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener(this) {
            final /* synthetic */ dlk ˊ;

            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                this.ˊ.ˋ.onCheckedChanged(checkBox, z);
            }
        });
        ((TextView) inflate.findViewById(R.id.selectableApp_titleTV)).setText(startupResponse$OOBEAppInfo.ˏ());
        int i4 = i2 % i != 0 ? 1 : 0;
        ˊ = ContentManager.getInstant().getContext().getResources().getDimensionPixelSize(R.dimen.margin_m);
        int dimensionPixelSize = ContentManager.getInstant().getContext().getResources().getDimensionPixelSize(R.dimen.margin_l);
        if (MinimumFactory.getBoolValue(context)) {
            if (i2 < i) {
                if (i4 != 0) {
                    linearLayout.setPadding(0, 0, i3, ˊ);
                } else {
                    linearLayout.setPadding(0, 0, 0, ˊ);
                }
            } else if (i4 != 0) {
                linearLayout.setPadding(0, dimensionPixelSize, i3, ˊ);
            } else {
                linearLayout.setPadding(0, dimensionPixelSize, 0, ˊ);
            }
        } else if (i2 < i) {
            if (i4 != 0) {
                linearLayout.setPadding(i3, 0, 0, ˊ);
            } else {
                linearLayout.setPadding(0, 0, 0, ˊ);
            }
        } else if (i4 != 0) {
            linearLayout.setPadding(i3, dimensionPixelSize, 0, ˊ);
        } else {
            linearLayout.setPadding(0, dimensionPixelSize, 0, ˊ);
        }
        return inflate;
    }

    private void ˋ(CheckBox checkBox, StartupResponse$OOBEAppInfo startupResponse$OOBEAppInfo) {
        checkBox.setChecked(startupResponse$OOBEAppInfo.ॱॱ());
        if (startupResponse$OOBEAppInfo.ˏॱ() == 3) {
            this.ॱ = true;
            checkBox.setEnabled(false);
        }
    }

    public LinearLayout ˏ(Context context) {
        LinearLayout linearLayout = new LinearLayout(context);
        linearLayout.setOrientation(0);
        return linearLayout;
    }

    public void ˎ(OnCheckedChangeListener onCheckedChangeListener) {
        this.ˋ = onCheckedChangeListener;
    }

    public void ˋ(boolean z) {
        this.ˊ.setChecked(z);
    }

    public boolean ˏ() {
        return this.ॱ;
    }
}
